<!-- 文字输出 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <span id="text"></span>
    <script>
        const text = '人生能有几回搏，此时不搏何时搏？高三，加油！因为青春不拼不精彩，人生不拼没未来。';
        const textContainer = document.querySelector('#text');
        function showText (index) {
            if ( index < text.length ) {
                const char = text.charAt(index)
                textContainer.innerHTML +=char
                index++
                setTimeout(() => showText(index), 100)
            }
        }
        showText(0)
    </script>
</body>
</html>